package org.goyo.main.domain.entity.storage;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.goyo.main.domain.entity.BaseObject;
import org.goyo.main.domain.entity.base.Customer;
/**
 * 销售出库
 * 
 * @author chenchuan
 * 2014年11月12日
 */
@Entity
public class SaleOutStorage  extends BaseObject implements Serializable {

	private static final long serialVersionUID = 1L;
	//单据编号前缀
	public static final String BIZTYPE = "XSCK";
	/**
	 * 业务类型	
	 */
	@Column
	private String bizType;
	/**
	 * 客户	
	 */
	@ManyToOne
	@JoinColumn(name="customerId")
	private Customer customer;
	
	@OneToMany(fetch = FetchType.LAZY,cascade={CascadeType.ALL})
	@JoinColumn(name="parent_id")
	private List<SaleOutStorageEntry> entrys = new ArrayList<SaleOutStorageEntry>();
	public String getBizType() {
		return bizType;
	}
	public void setBizType(String bizType) {
		this.bizType = bizType;
	}
	public List<SaleOutStorageEntry> getEntrys() {
		return entrys;
	}
	public void setEntrys(List<SaleOutStorageEntry> entrys) {
		this.entrys = entrys;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		if(customer != null &&("".equals(customer.getUuid()) || customer.getUuid()==null))
			this.customer = null;
		else
			this.customer = customer;	
	}
}
